﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;






namespace GamePlay
{

    public class Game1 : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;





        //Texture2D                    builder;
        //Vector2                      position;

        builder p;
        RandomObject a;

        //int                          gravity, speed;






        // Build
        public Game1()
            : base()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";





            graphics.IsFullScreen =false;
            graphics.PreferredBackBufferWidth =829;
            graphics.PreferredBackBufferHeight = 600;
            graphics.ApplyChanges();



        }


        protected override void Initialize()
        {
            // TODO: Add your initialization logic here



            base.Initialize();
        }


        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //p = Content.Load<Texture2D>("pessonagem");
            p = new builder();
            a = new RandomObject();
            p.Texture = Content.Load<Texture2D>(@"Pessonagem");
            //p.Texture = Content.Load<Texture2D>(@"Pessonagem");
            a.Texture = Content.Load<Texture2D>(@"Pessonagem");
            //p.Texture = Content.Load<Texture2D>("Content/Pessonagem");
            // TODO: use this.Content to load your game content here


        }


        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
                Console.WriteLine("End");




            }

            //if (Keyboard.GetState().IsKeyDown(Keys.C))
            //{
            //    //graphics.PreferredBackBufferWidth =3000; 
            //    //graphics.PreferredBackBufferHeight =20000 ;
            //    //Console.WriteLine(" Test press");
            //}



            p.Update();
            a.Update();

            // TODO: Add your update logic here

            base.Update(gameTime);
        }


        protected override void Draw(GameTime gameTime)
        {
            //padrão = CornflowerBlue
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            //spriteBatch.Draw(builder, position= new Vector2(200,10) , Color.White);
            //p.Draw(builder, position, Color.White);
            a.Draw(spriteBatch);
            p.Draw(spriteBatch);
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}
